package bob

import (
	"regexp"
	"strings"
)

const testVersion = 3

var R1 = regexp.MustCompile(`[a-zA-Z]+`)
var R2 = regexp.MustCompile(`[a-zA-Z0-9]+`)

func Hey(input string) string {
	input = strings.TrimSpace(input)

	if r := R1.FindString(input); r != "" && r == strings.ToUpper(r) {
		return "Whoa, chill out!"
	}

	if p := strings.Index(input, "?"); p > 0 && p+1 == len(input) {
		return "Sure."
	}

	if r := R2.FindString(input); r == "" {
		return "Fine. Be that way!"
	}

	return "Whatever."
}
